1. Field of the Invention
The invention relates to a barcode reader and a computer program product.
2. Description of Related Art
Some conventionally-known barcode readers use a laser beam to scan a one-dimensional barcode. Such a barcode reader scans a barcode by emitting and swinging a laser beam in a cross direction, receiving the beam reflected on the barcode to obtain image data, and decoding the image data using a predetermined threshold. The image data has a data structure in which obtained data widths of black bars and data widths of white spaces are sequentially (alternately) arranged according to the image of the barcode. The predetermined threshold is a threshold to determine the data widths (thicknesses) of the black bars and white spaces.
The threshold used to decode image data is previously set according to the type of the barcode reader, the optical system (lens magnification), bar thickness, and the like. In another known barcode reader, the threshold used to decode image data can be externally inputted and set to be changed (see Japanese Patent Laid-open Publication No. H6-290294, for example).
However, according to the conventional barcode readers, the reflected light may not be enough at each end of the swing width (irradiation width) of the laser beam in some cases. The obtained image data is therefore unstable, and the proportions of black bars and white spaces may not be correctly obtained. Accordingly, when the barcode is scanned by the both ends of the swing width of the laser beam, the proportions of the black bars and white spaces look broken. Decoding such image data may result in misreading.
One of the methods to prevent misreading in the conventional barcode readers is tight adjustment of the threshold. The tight adjustment of the threshold refers to adjusting and lowering the tolerance of error of the image data against the threshold.
However, if the threshold is simply adjusted tightly, the threshold serves tightly at reading of scanned data in central part of the swing width of the laser beam where the proportions of black bars and white spaces are correct. Accordingly, reading may not be executed in the case where the proportions of printed black bars and white spaces of the same width include even a little error, the case where the barcode reader is distant from the barcode, and the like.